package ua.org.cityid.server.handlers;


import com.google.inject.Inject;

import ua.org.cityid.client.actions.GetCities;
import ua.org.cityid.client.actions.GetCitiesResult;
import ua.org.cityid.server.DA.CityDA;
import net.customware.gwt.dispatch.server.ActionHandler;
import net.customware.gwt.dispatch.server.ExecutionContext;
import net.customware.gwt.dispatch.shared.ActionException;

public class GetCitiesHandler implements ActionHandler<GetCities, GetCitiesResult>{
	private CityDA dataAccess = null;
	
	@Inject
	public GetCitiesHandler(CityDA cityDA){
		dataAccess = cityDA;
	}
	
	@Override
	public GetCitiesResult execute(GetCities params, ExecutionContext arg1)
			throws ActionException {
		return dataAccess.getCities(params);
	}

	@Override
	public Class<GetCities> getActionType() {
		return GetCities.class;
	}

	@Override
	public void rollback(GetCities arg0, GetCitiesResult arg1,
			ExecutionContext arg2) throws ActionException {
		//Not needed for get
	}

}
